<template>
    <div>
        <!-- 头部 -->
        <div class="frist_show">
            <el-breadcrumb separator-class="el-icon-arrow-right">
              <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
              <el-breadcrumb-item>评估报告</el-breadcrumb-item>
            </el-breadcrumb>
            <el-divider></el-divider>
        </div>

        <!-- 体质报告结果 -->
        <div style="width:1300px;height:400px;position: absolute;top:100px;left:100px;box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);">
            <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
                <el-tab-pane label="体质测评报告" name="first">
                    <div>
                        <el-descriptions class="margin-top" :column="2" border style="margin-top:30px">
                            <el-descriptions-item>
                            <template slot="label">
                                用户名
                            </template>
                            {{conlist.conTestName}}
                            </el-descriptions-item>
                            <el-descriptions-item>
                            <template slot="label">
                                评估日期
                            </template>
                            {{conlist.conTestDatetime}}
                            </el-descriptions-item>
                            <el-descriptions-item>
                            <template slot="label">
                                平和质
                            </template>
                            {{conlist.conTestPinghe}}
                            </el-descriptions-item>
                            <el-descriptions-item>
                            <template slot="label">
                                气虚质
                            </template>
                            {{conlist.conTestQixu}}
                            </el-descriptions-item>
                            <el-descriptions-item>
                            <template slot="label">
                                阳虚质
                            </template>
                            {{conlist.conTestYangxu}}
                            </el-descriptions-item>
                            <el-descriptions-item>
                            <template slot="label">
                                阴虚质
                            </template>
                            {{conlist.conTestYinxu}}
                            </el-descriptions-item>
                            <el-descriptions-item>
                            <template slot="label">
                                痰湿质
                            </template>
                            {{conlist.conTestTanshi}}
                            </el-descriptions-item>
                            <el-descriptions-item>
                            <template slot="label">
                                湿热质
                            </template>
                            {{conlist.conTestShire}}
                            </el-descriptions-item>
                            <el-descriptions-item>
                            <template slot="label">
                                血瘀质
                            </template>
                            {{conlist.conTestXueyu}}
                            </el-descriptions-item>
                            <el-descriptions-item>
                            <template slot="label">
                                气郁质
                            </template>
                            {{conlist.conTestQiyu}}
                            </el-descriptions-item>
                            <el-descriptions-item>
                            <template slot="label">
                                特禀质
                            </template>
                            {{conlist.conTestTebing}}
                            </el-descriptions-item>
                        </el-descriptions>
                    </div>
                </el-tab-pane>
                <el-tab-pane label="心理测评报告" name="second">
                    <div>
                        <el-descriptions class="margin-top" :column="2" :size="size" border style="margin-top:50px">
                        <el-descriptions-item>
                        <template slot="label">
                            <i class="el-icon-user"></i>
                            用户名
                        </template>
                        {{mindlist.mindTestName}}
                        </el-descriptions-item>
                        <el-descriptions-item>
                        <template slot="label">
                            评估日期
                        </template>
                        {{mindlist.mindTestDatetime}}
                        </el-descriptions-item>
                        <el-descriptions-item>
                        <template slot="label">
                            躯体化
                        </template>
                        {{mindlist.mindTestQuti}}
                        </el-descriptions-item>
                        <el-descriptions-item>
                        <template slot="label">
                            强迫症
                        </template>
                        {{mindlist.mindTestQiangpozheng}}
                        </el-descriptions-item>
                        <el-descriptions-item>
                        <template slot="label">
                            人际关系敏感
                        </template>
                        {{mindlist.mindTestRenji}}
                        </el-descriptions-item>
                        <el-descriptions-item>
                        <template slot="label">
                            犹豫
                        </template>
                        {{mindlist.mindTestYouyu}}
                        </el-descriptions-item>
                        <el-descriptions-item>
                        <template slot="label">
                            焦虑
                        </template>
                        {{mindlist.mindTestJiaolv}}
                        </el-descriptions-item>
                        <el-descriptions-item>
                        <template slot="label">
                            敌对
                        </template>
                        {{mindlist.mindTestDidui}}
                        </el-descriptions-item>
                        <el-descriptions-item>
                        <template slot="label">
                            恐怖
                        </template>
                        {{mindlist.mindTestKongbu}}
                        </el-descriptions-item>
                        <el-descriptions-item>
                        <template slot="label">
                        偏执
                        </template>
                        {{mindlist.mindTestPianzhi}}
                        </el-descriptions-item>
                        <el-descriptions-item>
                        <template slot="label">
                            精神病性
                        </template>
                        {{mindlist.mindTestJingshenbing}}
                        </el-descriptions-item>
                    </el-descriptions>
                </div>
                </el-tab-pane>
                 <el-tab-pane label="风险测评报告" name="third">
                    <div>
                        <el-descriptions class="margin-top" :column="2" :size="size" border style="margin-top:50px">
                        <el-descriptions-item>
                        <template slot="label">
                            用户名
                        </template>
                        {{risklist.riskTestName}}
                        </el-descriptions-item>
                        <el-descriptions-item>
                        <template slot="label">
                            评估日期
                        </template>
                        {{risklist.riskTestDatetime}}
                        </el-descriptions-item>
                        <el-descriptions-item>
                        <template slot="label">
                        膳食情况
                        </template>
                        {{risklist.riskTestFood}}
                        </el-descriptions-item>
                        <el-descriptions-item>
                        <template slot="label">
                            运动情况
                        </template>
                        {{risklist.riskTestKeep}}
                        </el-descriptions-item>
                        <el-descriptions-item>
                        <template slot="label">
                            吸烟情况
                        </template>
                        {{risklist.riskTestSmoke}}
                        </el-descriptions-item>
                        </el-descriptions>
                    </div>
                </el-tab-pane>
            </el-tabs>
        </div>
    </div>
</template>

<script>
export default {
  name: 'Constitution',
  data () {
    return {
      userid: this.$route.params.userid,
      rval: this.$route.params.rval,
      size: '',
      conlist: {},
      mindlist: {},
      risklist: {},
      activeName: 'first'
    }
  },
  methods: {
    handleClick (tab, event) {
      let mname = sessionStorage.getItem('user')
      let muser = JSON.parse(mname)
      this.$axios.post(`/api/mindtest/selectbaogao/${this.userid}`).then(result => {
        this.conlist = result.data
        if (result.data === '' || result.data === null || result.data === 'null') {
          this.conlist = {conTestName: muser.memName, conTestDatetime: '无', conTestPinghe: '未测评', conTestQixu: '未测评', conTestYangxu: '未测评', conTestYinxu: '未测评', conTestTanshi: '未测评', conTestShire: '未测评', conTestXueyu: '未测评', conTestQiyu: '未测评', conTestTebing: '未测评'}
        }
      })
      this.$axios.post(`/api/mindtest/selectxinlibaogao/${this.userid}`).then(results => {
        this.mindlist = results.data
        if (results.data === '' || results.data === null || results.data === 'null') {
          this.mindlist = {mindTestName: muser.memName, mindTestDatetime: '无', mindTestQuti: '未测评', mindTestQiangpozheng: '未测评', mindTestRenji: '未测评', mindTestYouyu: '未测评', mindTestJiaolv: '未测评', mindTestDidui: '未测评', mindTestKongbu: '未测评', mindTestPianzhi: '未测评', mindTestJingshenbing: '未测评'}
        }
      })
      this.$axios.post(`/api/mindtest/selectfengxianbaogao/${this.userid}`).then(resultsfx => {
        this.risklist = resultsfx.data
        if (resultsfx.data === '' || resultsfx.data === null || resultsfx.data === 'null') {
          this.risklist = {riskTestName: muser.memName, riskTestDatetime: '无', riskTestFood: '未测评', riskTestKeep: '未测评', riskTestSmoke: '未测评'}
        }
      })
    }
  },
  created () {
    this.handleClick()
  }
}
</script>

<style>
.frist_show{position: absolute;top: 0px;left:20px;width: 1500px;height: 50px;}
.frist_show .el-breadcrumb{margin-top: 15px;}
</style>
